<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/6/14
  Time: 18:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body>

<table cellspacing="30px">
  <tr>
    <th >id</th>
    <th>username</th>
    <th>password</th>
    <th>description</th>
    <th>操作</th>
  </tr>
 <c:forEach items="${pager.data}" var="user">
 <tr>

   <td>${user.userId}</td>
   <td>${user.username}</td>
   <td>${user.password}</td>
   <td>${user.description}</td>
   <td><a href="/user/delete/${user.userId}">删除</a></td>
   <td><a href="/user/edit/${user.userId}">修改</a></td>
 </tr>

 </c:forEach>
</table>
<a href="/user/add" cellspacing="30px">添加</a><br/><br/>
<c:if test="${pager.pageIndex!=1}">
    <a href="/users/${pager.pageIndex-1}">上一页</a>
</c:if>

<c:forEach begin="1" end="${pager.allPage}" varStatus="varstatus">
    <c:if test="${pager.pageIndex!=varstatus.index}">
        <a href="/users/${varstatus.index}">${varstatus.index}</a>
    </c:if>

    <c:if test="${pager.pageIndex==varstatus.index}">
        <span>${varstatus.index}</span>
    </c:if>
    </c:forEach>
<c:if test="${pager.pageIndex!=pager.allPage}">
    <a href="/users/${pager.pageIndex+1}">下一页</a>
</c:if>

</body>
</html>
